<?php
class Zendvn_View_Helper_CmsFck extends Zend_View_Helper_Abstract
{
	/*
	 * $attribs = array();
	 * $attribs['toolbar'] 
	 * $attribs['language'] 
	 * $attribs['width'] 
	 * $attribs['height'] 
	 */
	
	/*
	 * $options['ProcessHTMLEntities']
	 * $options['ProcessNumericEntities'] 
	 */
	public function cmsFck($name,$value = null, $attribs = null, $options = null){
		require_once (SCRIPTS_PATH . '/fckeditor/fckeditor_php5.php');
		
		$sBasePath = SCRIPTS_URL . '/fckeditor/';
		
		
		$oFCKeditor = new FCKeditor($name) ;
		$oFCKeditor->Value = $value;
		$oFCKeditor->BasePath = $sBasePath;
		
		if($attribs['toolbar'] != null ){
			$oFCKeditor->ToolbarSet = $attribs['toolbar'];
		}
		
		if($attribs['language'] != null ){
			$oFCKeditor->Config['AutoDetectLanguage'] = false;
			$oFCKeditor->Config['DefaultLanguage'] = $attribs['language'];
		}
		
		if($attribs['width'] != null ){
			$oFCKeditor->Width = $attribs['width'];
		}
		
		if($attribs['height'] != null ){
			$oFCKeditor->Height = $attribs['height'];
		}
		
		if(count($options)>0){
			foreach ($options as $key => $val){
				$oFCKeditor->Config[$key] = $val;
			}
		}
	
		
		return $oFCKeditor->Create();
	}
}
